#include "bits/stdc++.h"
using namespace std;

int main(){
	int count = 0; 
	char str[20];
	for(int year=2022;year<=2022;year++)
	for(int month=1;month<=12;month++)
		for(int day=1;day<=31;day++)
		{
			if(month==1||month==3||month==5||month==7||month==8
				||month==10||month==12){
			}else if(month==2){
				if((year%4==0&&year%100!=0)||year %400==0)
				{
					if(day>29) break;
				}else{
					if(day>28) break;
				}
			}else{
				if(day>30)break;
			}
			sprintf(str,"%d%02d%02d",year,month,day);
			for(int k = 3;k+2 <= 7;k++){
				if(str[k+2]-str[k+1]==1&&str[k+1]-str[k]==1){
					count++;
					break;
				}
			}
		}
	cout << count;
	return 0;
}
